<%@ Page Language="C#" AutoEventWireup="true" %>
<%
    
    
    //执行no_list替换操作(3.0 to 3.3)
    //string sqllist="select id,no_list from cms_article";
    //System.Data.DataTable dt = PlugNT.Database.Common.Simple.DbHelper.GetDataTable(sqllist);
    //foreach (System.Data.DataRow dr in dt.Rows)
    //{
    //    string sql = "update cms_article set no_list='" + dr["no_list"].ToString().Replace(",", "_") + "' where id=" + dr["id"].ToString();
    //    if (PlugNT.Database.Common.Simple.DbHelper.ExecuteSql(sql) > 0)
    //    {
    //        Response.Write(dr["id"].ToString()+ "ok<br>");
    //    }
    //    else
    //    {
    //        Response.Write(dr["id"].ToString() + "error<br>");
    //    }
    //    Response.Flush();
    //}




    
        
    //更改栏目语句(3.3 to 3.5)
    //string sqllist = "select id,clsno from cms_channel_bad";
    //System.Data.DataTable dt = PlugNT.Database.Common.Simple.DbHelper.GetDataTable(sqllist);
    //System.Collections.Generic.Dictionary<string, string> tdic = new System.Collections.Generic.Dictionary<string, string>();
    //foreach (System.Data.DataRow dr in dt.Rows)
    //{
    //    tdic.Add(dr["clsno"].ToString(), dr["id"].ToString());
    //}
    //sqllist = "select id,clsno from cms_article_bad";
    //dt = PlugNT.Database.Common.Simple.DbHelper.GetDataTable(sqllist);
    //foreach (System.Data.DataRow dr in dt.Rows)
    //{
    //    string sid = "0";
    //    tdic.TryGetValue(dr["clsno"].ToString(), out sid);
    //    PlugNT.Database.Common.Simple.DbHelper.ExecuteSql("update cms_article_bad set clsno=" + sid + " where id=" + dr["id"].ToString());
    //    Response.Write(dr["id"].ToString() + "<br />");
    //    Response.Flush();
    //}





    //修改栏目pid(3.3 to 3.5)
    //System.Data.DataTable dt = new PlugNT.Cms.BLL.Channel().GetNolistList("");
    //System.Collections.Generic.Dictionary<string, string> tdic = new System.Collections.Generic.Dictionary<string, string>();
    //foreach (System.Data.DataRow dr in dt.Rows)
    //{
    //    tdic.Add(dr["no"].ToString(), dr["id"].ToString());
    //}
    //foreach (System.Data.DataRow dr in dt.Rows)
    //{
    //    string[] arr = dr["no_list"].ToString().Split('_');
    //    if (arr.Length == 2)
    //    {
    //        string sql = "update cms_channel set parent_id=0 where id=" + dr["id"].ToString();
    //        PlugNT.Database.Common.Simple.DbHelper.ExecuteSql(sql);
    //        Response.Write(sql + dr["id"].ToString() + "<br />");
    //    }
    //    else
    //    {
    //        string sid = "";
    //        tdic.TryGetValue(arr[arr.Length - 2], out sid);

    //        string sql = "update cms_channel set parent_id=" + sid + " where id=" + dr["id"].ToString();
    //        PlugNT.Database.Common.Simple.DbHelper.ExecuteSql(sql);
    //        Response.Write(sql + dr["id"].ToString() + "<br />");
    //    }
    //}



    //StringBuilder strSql = new StringBuilder();
    //strSql.Append("select distinct channel_id,[type] from [cms_templet]");
    //strSql.Append(" where sys_model_id =3");
    //strSql.Append(" Order By [channel_id] Asc");
    //Response.Write(strSql.ToString());
    //System.Data.DataTable dt = PlugNT.Database.Common.Simple.DbHelper.GetDataTable(strSql.ToString());
    //foreach (System.Data.DataRow dr in dt.Rows)
    //{
    //    Response.Write(dr["id"].ToString() + "<br />");
    //    Response.Flush();
    //}

    //System.Data.DataRow dr=PlugNT.Cms.BLL.Article.GetUDataRow(3, 179);
    //int count=dr.Table.Columns.Count;
    //for (int i = 0; i < count; i++)
    //{
    //    Response.Write(dr.Table.Columns[i] + "-> " + dr[dr.Table.Columns[i]].ToString() + "<br />");
    //    Response.Flush();
    //}


    //StringBuilder strSql = new StringBuilder();
    //strSql.Append("select a.*,b.id,b.images,b.title,b.ext_goods_integral from ");
    //strSql.Append("cms_s_cart as a left join cms_article_2 as b ");
    //strSql.Append("on a.goods_id=b.id ");
    //strSql.Append(" where a.sys_model_id=2");
    
    //System.Data.DataTable dt = PlugNT.Database.Common.Simple.DbHelper.GetDataTable(strSql.ToString());
    //int colCount =dt.Columns.Count;
    //for(int i=0; i<colCount; i++){
    //    Response.Write(dt.Columns[i].ColumnName + "<br />");
    //    Response.Flush();
    //}
    
    
%>
